package xiegd.com.springbootuse.demo.primarystudy;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @Description:
 * @Author: xieguangda
 * @Date: 2021年08月12日 9:45
 */

@Configuration
public class PrimaryConfig {

    @Bean
    public MyBean myBeanOne(){
        MyBean myBean = new MyBean();
        System.out.println("我是myBeanOne：" + myBean);
        return myBean;
    }

    @Bean
    @Primary
    public MyBean myBeanTwo(){
        MyBean myBean = new MyBean();
        System.out.println("我是myBeanTwo：" + myBean);
        return myBean;
    }

    @Bean
    //@Primary
    public MyBean myBeanThird(){
        MyBean myBean = new MyBean();
        System.out.println("我是myBeanThird：" + myBean);
        return myBean;
    }
}